#include "login.h"
#include "ui_login.h"

Login::Login(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::Login)
{
    ui->setupUi(this);

    ui->m_lbRegister->setText("<a href=www.baidu.com>No account? click here to apply one</a>");

}

Login::~Login()
{
    delete ui;
}

void Login::on_m_pbLogin_clicked()
{
    ///get the account data at first

    ///then generate a package

    ///emit the package to the MainWindow to send to the server

    ///wait for response

    emit showGUI();
    done(1);
}

void Login::on_m_pbCancel_clicked()
{

    emit showGUI();
    done(0);
    //exit(0);
}

void Login::on_m_lbRegister_linkActivated(QString link)
{
    this->setVisible(false);

    Register r;
    r.exec();

    this->setVisible(true);
}
void Login::processLoginResponse(MSGHeader header,QByteArray data)
{
    ///check the response is YES or NO,if YES
    ///emit showGUI,or promot an error
}
